
package ogame.utilities.defenses;

/**
 *
 * @author scchang
 */
public class Defense {
    
    public static Defense ROCKET_LAUNCHER = new Defense("Rocket Launcher", 2000,
            20, 80,
            2000, 0, 0);
    public static Defense LIGHT_LASER = new Defense("Light Laser", 2000,
            25, 100,
            1500, 500, 0);
    public static Defense HEAVY_LASER = new Defense("Heavy Laser", 8000,
            100, 250,
            6000, 2000, 0);
    public static Defense ION_CANNON = new Defense("Ion Cannon", 8000,
            500, 150,
            2000, 6000, 0);
    public static Defense GAUSS_CANNON = new Defense("Gauss Cannon", 35000,
            200, 1100,
            20000, 15000, 2000);
    public static Defense PLASMA_TURRET = new Defense("Plasma Turret", 100000,
            300, 3000,
            50000, 50000, 30000);
    public static Defense SMALL_SHIELD_DOME = new Defense("Small Shield Dome", 20000,
            2000, 1, 
            10000, 10000, 0);
    public static Defense LARGE_SHIELD_DOME = new Defense("Large Shield Dome", 100000,
            10000, 1,
            50000, 50000, 0);
    public static Defense ANTIBALLISTIC_MISSILES = new Defense("Antiballistic Missiles", 0,
            0, 0,
            8000, 0, 2000);
    
    public static DefenseType defense2enum(Defense defense){
        for(DefenseType type : DefenseType.values()){
            if(defense.toString().toUpperCase().replace(" ", "_").
                    equals(type.name())){
                return type;
            }
        }
        return null;
    }
    
    public static Defense enum2Defense(DefenseType type){
        switch(type){
            case ROCKET_LAUNCHER:
                return Defense.ROCKET_LAUNCHER;
            case LIGHT_LASER:
                return Defense.LIGHT_LASER;
            case HEAVY_LASER:
                return Defense.HEAVY_LASER;
            case GAUSS_CANNON:
                return Defense.GAUSS_CANNON;
            case ION_CANNON:
                return Defense.ION_CANNON;
            case PLASMA_TURRET:
                return Defense.PLASMA_TURRET;
            case SMALL_SHIELD_DOME:
                return Defense.SMALL_SHIELD_DOME;
            case LARGE_SHIELD_DOME:
                return Defense.LARGE_SHIELD_DOME;
            case ANTIBALLISTIC_MISSILES:
                return Defense.ANTIBALLISTIC_MISSILES;
            default:
                return null;
        }
    }
    
    protected String name;
    protected double structual_integrity;
    protected double shield;
    protected double weapon;
    protected double metal;
    protected double crystal;
    protected double deut;
    
    protected Defense(String name, double struct,
            double shield, double weapon,
            double metal, double crystal, double deut){
        this.name = name;
        this.structual_integrity = struct;
        this.shield = shield;
        this.weapon = weapon;
        this.metal = metal;
        this.crystal = crystal;
        this.deut = deut;
                
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @return the structual_integrity
     */
    public double getStructual_integrity() {
        return structual_integrity;
    }

    /**
     * @return the shield
     */
    public double getShield() {
        return shield;
    }

    /**
     * @return the weapon
     */
    public double getWeapon() {
        return weapon;
    }

    /**
     * @return the metal
     */
    public double getMetal() {
        return metal;
    }

    /**
     * @return the crystal
     */
    public double getCrystal() {
        return crystal;
    }

    /**
     * @return the deut
     */
    public double getDeut() {
        return deut;
    }
    
    public String toString(){
        return this.name;
    }
    

}
